/**
    <one line to give the program's name and a brief idea of what it does.>
    Copyright (C) 2010  Sean Beecroft, Cay Horstmann

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.

 * @version 1.10 2010-01-01
 * @author Cay Horstmann, Sean Beecroft
 */

package mandelbrotexplorer;

import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JFrame;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JOptionPane;

class MandelbrotFrame extends JFrame {
	
	private static final long serialVersionUID = 1L;

	public MandelbrotFrame() {
		setTitle("Mandelbrot Explorer version 1.2");
		setSize(400, 400);
		//Authors: Sean Beecroft, Cay Horstmann
		addWindowListener(new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		});

		final JFrame j = this;
		JMenuBar menubar = new JMenuBar();
		JMenu file = new JMenu("File");
		JMenuItem about = new JMenuItem("About");
		JMenuItem exit = new JMenuItem("Exit");
		exit.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO Auto-generated method stub
				System.exit(-1);
			}
		});

		about.addActionListener(new ActionListener() {
			@Override
			public void actionPerformed(ActionEvent arg0) {
				// TODO Auto-generated method stub
				JOptionPane.showMessageDialog(j, "This application was written by Sean Beecroft in 2010,\n based on original work by Dr. Cay Horstmann in 1999", "About Mandelbrot Explorer", JOptionPane.INFORMATION_MESSAGE);
			}
		});

		file.add(about);
		file.add(exit);
		menubar.add(file);
		this.setJMenuBar(menubar);

		Container contentPane = getContentPane();
		MandelbrotPanel mp = new MandelbrotPanel();
		contentPane.add(mp, "Center");

	}
}